package
{
	import flash.events.TimerEvent;
	import flash.utils.Timer;

	public class AIController
	{
		public var apm:int = 5;
		public var homeBase:HomeBase;
		
		private var m_aiTimer:Timer;
		
		public function AIController()
		{
		}
		
		public function start():void{
			var apms:int = 1000 / (this.apm/60);
			m_aiTimer = new Timer(apms);
			m_aiTimer.addEventListener(TimerEvent.TIMER, onAITick);
			m_aiTimer.start();
			homeBase.createGasGatherer();
		}
		
		private function onAITick(te:TimerEvent):void{
			if(homeBase.gasGathered >= 30){
				homeBase.createGasGatherer();	
			}
			
			if(homeBase.gasGathered >= 10){
				homeBase.createAttacker();	
			}
			
		}
	}
}